// pages/qs/qs.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    qq:0,
    toabc: "",
    classes: [],
    max_height: 667
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (e) {
    var tt = wx.getSystemInfoSync(), that = this
    console.log(e)
    that.setData({
      qq:e.qq
    })
    app.util.request({
      url: "entry/wxapp/Api",
      data: {
        m: "monai_market",
        r: "extends.postion",
      },
      success: function (t) { 
        console.log(t)
        that.setData({
          classes: t.data.data,
          max_height: tt.windowHeight
        });
      }
    });

  },
  retoabc: function (a) {
    this.setData({
      toabc: a.currentTarget.dataset.abc
    });
  },
  backid: function(e){
    console.log(e)
    var that = this
    var id = e.currentTarget.dataset.id
    var name = e.currentTarget.dataset.name 
    if (id == null && that.data.qq==0) {
      console.log('jinlai')
      var region = []
      region.push(name)
      var pages = getCurrentPages();
      var currPage = pages[pages.length - 1];   //当前页面
      var prevPage = pages[pages.length - 2];  //返回的页面
      wx.navigateBack({ delta: 1 });
      prevPage.setData({
        region: region,
        xiugai: 100,
        search_arr: [{ check_name:name, active_index: 8 }]
      });
    } else if (id == null && that.data.qq == 1){
      var pages = getCurrentPages();
      var currPage = pages[pages.length - 1];   //当前页面
      var prevPage = pages[pages.length - 2];  //返回的页面
      wx.navigateBack({ delta: 1 });
      prevPage.setData({
        location: name,
      });
    } else if (that.data.qq == 1){
      wx.navigateTo({
        url: '../qshi/qshi?id=' + id + "&name=" + name +"&qq=1"
      })
    }else{
      wx.navigateTo({
        url: '../qshi/qshi?id=' + id + "&name=" + name
      })
    }
    
  }
})